home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kscrollview.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  1.7 KB  |  63 lines

  1. /* This file is part of the KDE libraries
  2.    Copyright (C) 2005 Allan Sandfeld Jensen <kde@carewolf.com>
  3.  
  4.    This library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public
  6.    License version 2 as published by the Free Software Foundation.
  7.  
  8.    This library is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.    Library General Public License for more details.
  12.  
  13.    You should have received a copy of the GNU Library General Public License
  14.    along with this library; see the file COPYING.LIB.  If not, write to
  15.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16.    Boston, MA 02110-1301, USA.
  17. */
  18. #ifndef KSCROLLVIEW_H
  19. #define KSCROLLVIEW_H
  20.  
  21. #include <qscrollview.h>
  22.  
  23. #include <kdelibs_export.h>
  24.  
  25. /**
  26.  * @short A variant of QScrollView that supports smooth scrolling.
  27.  *
  28.  *
  29.  **/
  30. class KDEUI_EXPORT KScrollView : public QScrollView
  31. {
  32.   Q_OBJECT
  33.  
  34. public:
  35.     KScrollView( QWidget *parent = 0, const char *name = 0, Qt::WFlags f = 0 );
  36.  
  37.     ~KScrollView();
  38.  
  39. public slots:
  40.     void scrollBy(int dx, int dy);
  41. //    virtual void setContentsPos(int x, int y);
  42.  
  43. protected:
  44.     virtual void wheelEvent( QWheelEvent *e );
  45.  
  46.     void startScrolling();
  47.     void stopScrolling();
  48.  
  49. protected slots:
  50.     void scrollTick();
  51.  
  52. private:
  53.     // All scrolls must be completed within 240ms of last keypress
  54.     static const int SCROLL_TIME = 240;
  55.     // Each step is 20 ms == 50 frames/second
  56.     static const int SCROLL_TICK = 20;
  57.  
  58.     struct KScrollViewPrivate;
  59.     KScrollViewPrivate *d;
  60. };
  61.  
  62. #endif
  63.